# 创建 tools 静态库
add_library(tools STATIC
    ulog/ulog.c
    ulog/ulog_port.c
    CherryUSB/core/usbd_core.c 
    CherryUSB/class/cdc/usbd_cdc_acm.c 
    CherryUSB/port/dwc2/usb_dc_dwc2.c 
    CherryUSB/port/dwc2/usb_glue_st.c
    shell/shell.c
)

# 设置包含目录
target_include_directories(tools
    PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/ulog
    ${CMAKE_CURRENT_SOURCE_DIR}/CherryUSB/core
    ${CMAKE_CURRENT_SOURCE_DIR}/CherryUSB/class/cdc
    ${CMAKE_CURRENT_SOURCE_DIR}/CherryUSB/common 
    ${CMAKE_CURRENT_SOURCE_DIR}/CherryUSB/port/dwc2 
    ${CMAKE_CURRENT_SOURCE_DIR}/CherryUSB/class/hub
    ${CMAKE_CURRENT_SOURCE_DIR}/shell
)

# 链接必要的库
target_link_libraries(tools stm32cubemx ThreadX applications bsp)

# 将 tools 添加到主项目
target_link_libraries(${PROJECT_NAME} tools)
